Save your logs in a blockchain structure
You can create a class that Extends dc.Persistent Long Abstract
After any change in the registry, it will be saved in ^GBlockchainLog(, )
Example of creating a financial blockchain Using Embedded Python on IRIS Data Platform
Blockchain is a chain of blocks, where each block contains information from the previous block, this concept can be applied in many ways.
Block will be composed of: a datetime, index, content, hash and the hash of the previous block.
In this project the blocks are constructed by:
Make sure you have git and Docker desktop installed.
Clone/git pull the repo into any local directory
$ git clone https://github.com/Davi-Massaru/blockchain_Iris_python.git
Open the terminal in this directory and run:
$ docker-compose build && docker-compose up -d
Run the endpoint curl http://localhost:52773/api/blockchain/ping
to verify the connection to the server
After installing the application, you can access the end-points to better understand how it works
Returns the current state of blockchain
Response sample:
Add a new transaction to be computed in a block, and return which block the transaction will be added
Request Content:
{
"sender": "user 1",
"amount": 1.42,
"recipient": "user 2"
}
Response sample:
Start mining a new block that will be added to the chain, returns added block information
Response sample:
Returns block information, in the given index
Response sample:
You can better understand and track global content and transactions through the portal.
Access http://localhost:52773/csp/sys/exp/UtilExpGlobalView.csp?$ID2=GBlockchain&$NAMESPACE=USER&$NAMESPACE=USER to see all blockchain content.
Access http://localhost:52773/csp/sys/exp/UtilExpGlobalView.csp?$ID2=GTransactions&$NAMESPACE=USER&$NAMESPACE=USER to see all transactions made and in which blocks were mined